package com.health.circle.controller;

import com.health.circle.domain.dto.AnnounceCircleDto;
import com.health.circle.service.PatientCircleService;
import com.health.circle.util.OssUtil;
import com.health.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @BelongsProject: dimensionality-manage
 * @BelongsPackage: com.health.circle.controller
 * @Author: 许力匀
 * @CreateTime: 2024-12-16  09:57
 * @Description: 病友圈控制层
 * @Version: 1.0
 */
@RestController
@RequestMapping("circle")
public class CircleController {
    @Autowired
    private PatientCircleService patientCircleService;

    @Autowired
    private OssUtil ossUtil;

    /**
     * 发布病友圈
     */
    @PostMapping("announce")
    public R<String> publishCircle(@RequestBody AnnounceCircleDto announceCircleDto){
        patientCircleService.patientCircle(announceCircleDto);
        return  R.ok("发布成功");

    }

    /**
     * 上传图片
     */
    @PostMapping("upload")
    public R<String> upload(@RequestParam("file") MultipartFile file) {
        String s = ossUtil.uploadImg2Oss(file);
        return R.ok(s);
    }





}
